<%# Careful! This is duplicated at: https://github.com/gocd/oauth2_provider_engine/blob
    /master/app/views/oauth2_provider/user_tokens/_submit_with_prompt.html.erb %>
<script type="text/javascript">
    <%- button_container = scope[:button_container] -%>
    <%- button_id = scope[:button_id] -%>
    <%- button_selector =  button_container == nil ? button_id : "#{button_container} ##{button_id}" -%>
    <%- prompt_selector =  button_container == nil ? "#{button_id} #warning_prompt" : "#{button_container} #warning_prompt" -%>
    <%- message = scope[:message] -%>
    <%- on_confirmation_js = scope[:on_confirmation_js] -%>
    jQuery(Util.escapeDotsFromId('<%=button_selector-%>')).click(function() {
        Modalbox.show(jQuery(Util.escapeDotsFromId('<%=prompt_selector-%>'))[0], {overlayClose: false, title: 'Confirm Deletion'});
    });
</script>
<div id="warning_prompt" class="warning" style="display:none;">
    <div class="ui-dialog-content">
        <p><%= message %></p>
    </div>
    <div class="form_buttons actions">
        <%= submit_button('Proceed', :class=> "primary", :onclick => on_confirmation_js ) %>
        <%= submit_button('Cancel', :onclick => "Modalbox.hide()", :type => "button") %>
    </div>
</div>
